package com.zdxlz.fcmp.upms.admin;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zdxlz.fcmp.common.core.constant.enums.OperateTypeEnum;
import com.zdxlz.fcmp.common.core.util.R;
import com.zdxlz.fcmp.common.log.annotation.LogRecord;
import com.zdxlz.fcmp.upms.api.dto.SystemLogReqDto;
import com.zdxlz.fcmp.upms.api.service.impl.AbstractSystemLogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static com.zdxlz.fcmp.common.core.constant.CommonConstants.OPERATION_SUCCESS;

/**
 * 系统日志控制层
 *
 * @author aman
 * @since 2025-01-15 16:59:00
 */
@RestController
@Tag(name = "日志管理模块")
@LogRecord(module = "日志管理模块")
@RequestMapping("/api/v1/sys/log")
public class SystemLogController<T> extends AbstractSystemLogService<T>{

    /**
     * @Description：查询菜单路由名称列表
     * @Author：aman
     * @Date：2025/1/17 09:47
     */
    @GetMapping
    @Operation(summary = "分页查询日志")
    @LogRecord(module = "分页查询日志", value = "查询条件，日志类型【{}】", field = {"logType"}, operType = OperateTypeEnum.SELECT)
    public R select(@ParameterObject Page page, @ParameterObject SystemLogReqDto dto) {
        return R.ok(selectSystemLog(page, dto), OPERATION_SUCCESS);
    }
}
